package com.booby.algorithm.merge;

import com.booby.algorithm.utils.DataCheckUtil;
import com.booby.algorithm.utils.IntComparator;
import com.booby.algorithm.utils.Utils;

import java.util.Arrays;
import java.util.Comparator;

/**
 * 功能描述: 归并排序校验
 *
 * @author: lizt
 * @date: 2020/8/23 23:37
 **/

public class MergeCheck {
    public static void check(){

        Integer[] array1 = DataCheckUtil.generateDataSource();
        Integer[] array2 = Arrays.copyOf(array1, array1.length);
        // 从小到大排序
        Arrays.sort(array1);
//        MinToMax.sorted(array2, 0 , array2.length-1);


//        System.out.println("----------------------------");

        // 传入比较器，实现从大到小排序
        Comparator comparator = new IntComparator();
        Arrays.sort(array1, comparator);
        MaxToMin.sorted(array2, 0, array2.length -1);
        MaxToMin.sorted(array2, 0, array2.length -1);
        Utils.print(array1, array2);
    }
}
